<?php
// 索引数组，一维通常出现会员中心，文章详情，商品详情

//$student = ['key' => 'value'];
$student = [
    'id' => '2020345098',
    'name' => '李四',
    'mobile' => '15955556666',
    'age' => 30
];

//echo $student['id'] . '-' . $student['name'] . '-' . $student['mobile'];

// 二维索引数组，文章列表、商品列表

$students = [
    [
        'id' => '2020345098',
        'name' => '李四',
        'mobile' => '15955556666',
        'age' => 30,
        'score' => [
            'chinese' => 90,
            'math' => 80
        ]
    ],
    [
        'id' => '2020345097',
        'name' => '张三',
        'mobile' => '15955557777',
        'age' => 29,
        'score' => [
            'chinese' => 70,
            'math' => 80
        ]
    ]
];

for($i = 0; $i < count($students); $i++) {
    echo $students[$i]['id'] . '-' . $students[$i]['name'] . '-' .
        ($students[$i]['score']['chinese'] + $students[$i]['score']['math']) / 2 . "<br>";
}